package org.xhnews.services;

import java.util.Timer;
import java.util.TimerTask;

import org.xhnews.bo.WeatherBo;
import org.xhnews.preferences.Preferences;

public class UpdateWeatherService {
	Timer timer = new Timer();

	public void start() {
		timer.schedule(new UpdateWeatherTask(), 80000, 1000*60*Preferences.weather_update_interval);
	}

	public void stop() {
		timer.cancel();
	}

	class UpdateWeatherTask extends TimerTask {
		public void run() {
			WeatherBo.updateWeathers();
			WeatherBo.updateWeatherDetails();
		}

	}
}
